import { UPLOAD_PATH_URL } from "@/constants/BaseConstants";

export const cdn_url = (url: string) => {
  if (url == undefined) {
    return UPLOAD_PATH_URL;
  }
  if (url.startsWith("http://") || url.startsWith("https://")) {
    return url;
  }
  return UPLOAD_PATH_URL + url;
};

export const remove_cdn_url = (url: string) => {
  if (url.startsWith(UPLOAD_PATH_URL)) {
    return url.replace(UPLOAD_PATH_URL, "");
  } else {
    return url;
  }
};
